// 'use strict';
angular.module('snPaasDev', ['ngMockE2E']).run(['$httpBackend',function($httpBackend) {

  // $httpBackend.whenPOST('/phones').respond(function(method, url, data) {
  //   var phone = angular.fromJson(data);
  //   phones.push(phone);
  //   return [200, phone, {}];
  // });


  var users = {
    "data":{	
	pageCount:12,
	pageNow:2,
	user:[
		{
			userName:'user1',
			userId:23,
			app:2,
			service:3,
			regTime:121323232323,
			memory:16,
			disk:260
		},
		{
			userName:'user1',
			userId:23,
			app:2,
			service:3,
			regTime:121323232323,
			memory:16,
			disk:260
		},
		{
			userName:'user1',
			userId:23,
			app:2,
			service:3,
			regTime:121323232323,
			memory:16,
			disk:260
		}
		
	]
},
    "success": true
};





  var userDetail = {
    "data":{
	userName:'dsdsdsd',
	regTime:324354432432343,
	lastLoginTime:343435543433,
	envList:[
		{
			envname:'dsdsd',
			envId:12,
			status:1,
			appName:'wefsdc',
			appId:323,
			sdk:'java',
			instance:2,
			runtime:'tomcat',
			sourcecode:'git://dsdddfdfdf',
			domain:'www.baidu.com',
			memory:512,
			service:[
				{
					name:'logservice',
					img:'img/avaimg.jpg'
				}
			],
			status:1,
			endTime:323343434
		},{
			envname:'dsdsd',
			envId:12,
			status:1,
			appName:'wefsdc',
			appId:323,
			instance:2,

			sdk:'java',
			memory:512,
			runtime:'tomcat',
			sourcecode:'git://dsdddfdfdf',
			domain:'www.baidu.com',
			service:[
				{
					name:'logservice',
					img:'img/avaimg.jpg'
				},{
					name:'logservice',
					img:'img/avaimg.jpg'
				},{
					name:'logservice',
					img:'img/avaimg.jpg'
				}
			],
			status:1,
			endTime:323343434
		},{
			envname:'dsdsd',
			envId:12,
			status:1,
			appName:'wefsdc',
			instance:2,
			appId:323,
			sdk:'java',
			memory:512,
			runtime:'tomcat',
			sourcecode:'git://dsdddfdfdf',
			domain:'www.baidu.com',
			service:[
				{
					name:'logservice',
					img:'http://www.baidu.com'
				}
			],
			status:1,
			endTime:323343434
		}
	],
	service:[
		{
			name:'logservice',
			envName:'dsfdfdf',
			startTime:121343434,
			endTime:343434343,
			params:'fdfdff'
		},{
			name:'logservice',
			envName:'dsfdfdf',
			startTime:121343434,
			endTime:343434343,
			params:'fdfdff'

		},{
			name:'logservice',
			envName:'dsfdfdf',
			startTime:null,
			endTime:343434343,
			params:'fdfdff'

		}
		
	],
	log:[
		{
			url:'http://www.baidu.com',
			param:'{dfdf="dfdfdf",dfggg="fdfdfff"}',
			time:212343434
		},{
			url:'http://www.baidu.com',
			param:'{dfdf="dfdfdf",dfggg="fdfdfff"}',
			time:212343434
		},{
			url:'http://www.baidu.com',
			param:'{dfdf="dfdfdf",dfggg="fdfdfff"}',
			time:212343434
		},{
			url:'http://www.baidu.com',
			param:'{dfdf="dfdfdf",dfggg="fdfdfff",dfggg="fdfdfff",dfggg="fdfdfff",dfggg="fdfdfff",dfggg="fdfdfff"}',
			time:212343434
		}
		
	]
},
    "success": true
};




var version = {
	    "data":[
			{
				name:'V120',
				version:1.12
			},
			{
				name:'V120',
				version:1.12
			},
			{
				name:'V120',
				version:1.12
			}
		],
	    "success": true
	};



var clusterMonit = {
		"data":[
			{
				name:'dea',
				cpuUsage:0.98,
				memoryUsage:0.23,
				amount:3,
				status:0
			},{
				name:'haproxy',
				cpuUsage:0.98,
				memoryUsage:0.23,
				amount:3,
				status:0
			},{
				name:'nats',
				cpuUsage:0.98,
				memoryUsage:0.23,
				amount:3,
				status:0
			}
		],
	    "success": true
}


var clusterList = {
		"data":[
			{
				deployId:'todayisgood',
				deploymentName:'cf222',
				createTime:2345671318,
				updateTime:2345678313,
				status:0
			}
				

		],
	    "success": true
}
var comp = {
		"data":[
			{
				index:0,
				ip:'122.111.114.141',
				cpuUsage:0.88,
				cpuCore:2,
				cpuLoad:'2.2,2.1,1.9',
				memoryUsage:0.8,
				status:1
			},{
				index:1,
				ip:'12.11.11.11',
				cpuUsage:0.88,
				cpuCore:2,
				cpuLoad:'2.2,2.1,1.9',
				memoryUsage:0.8,
				status:1
			},{
				index:2,
				ip:'12.11.11.11',
				cpuCore:2,
				cpuLoad:'2.2,2.1,1.9',
				cpuUsage:0.88,
				memoryUsage:0.8,
				status:1
			},{
				index:3,
				ip:'12.11.11.11',
				cpuUsage:0.88,
				cpuCore:2,
				cpuLoad:'2.2,2.1,1.9',
				memoryUsage:0.8,
				status:1
			}
		],
	    "success": true
}
var clusterDetail = {
	data:{
		deployId:'todayisgood',
		directorUuid:'sdsdsdsds',
		cfRelease:1.12,
		deploymentName:'idontknow',
		rootDomain:'test',
		componentDomain:'test2',
		runingtimeDomain:'test3',
		sdfsAddress:'test4',
		networkId:'test5',
		components:[
			{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "nats",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "ccng",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "consul",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "dea",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "doppler",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "etcd",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "haproxy",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "hm9000",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "loggregator_trafficcontroller",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "postgres",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "router",
				netId: "test1",
				overload: false
			},{
				count: 1,
				cpuCore: 1,
				memory: 1024,
				name: "uaa",
				netId: "test1",
				overload: false
			},
		]
	},
	success:true
};
	var wnList = {
		data:{
			page:10,
			pageNow:1,
			workorderList:[
				{
					"createTime": 1453801095000,
					"id": 3,
					"orderContext": "haha",
					"orderName": "haha",
					"orderState": 0,
					"readState": 1,
					"serialNum": 1,
					"updateTime": null,
					"userId": 6001911190,
					"userName": "6001911190"
				},{
					"createTime": 1453801095000,
					"id": 3,
					"orderContext": "haha",
					"orderName": "haha",
					"orderState": 0,
					"readState": 1,
					"serialNum": 1,
					"updateTime": null,
					"userId": 6001911190,
					"userName": "6001911190"
				},{
					"createTime": 1453801095000,
					"id": 3,
					"orderContext": "haha",
					"orderName": "haha",
					"orderState": 0,
					"readState": 0,
					"serialNum": 1,
					"updateTime": null,
					"userId": 6001911190,
					"userName": "6001911190"
				}
			]
		},
		success:true
	};
	var wodetail = {
		data: [
	        {
	            "content": "休息吧",
	            "createTime": "2015-12-17T16:18:58",
	            "serialNum": 2,
	            "userType": 1,
	            "workOrderId": 14
	        },{
	            "content": "休息吧",
	            "createTime": "2015-12-17T16:18:58",
	            "serialNum": 2,
	            "userType": 1,
	            "workOrderId": 14
	        },{
	            "content": "休息吧",
	            "createTime": "2015-12-17T16:18:58",
	            "serialNum": 2,
	            "userType": 0,
	            "workOrderId": 14
	        }
	    ],
		success:true
	};


	var mysqllist = {
    "data": [
        {
            deployId: "213",
            mysqlClusterName: "cf222",
            cfClusterName: " ",
            cfDeployId: " ",
            createTime: 2345671318,
            updateTime: 2345678313,
            mysqlStatus: 0,
            brokerStatus: 0,
            
        },{
            deployId: "213",
            mysqlClusterName: "cf222",
            cfClusterName: " ",
            cfDeployId: " ",
            createTime: 2345671318,
            updateTime: 2345678313,
            mysqlStatus: 0,
            brokerStatus: 0,
            
        },{
            deployId: "213",
            mysqlClusterName: "cf222",
            cfClusterName: " ",
            cfDeployId: " ",
            createTime: 2345671318,
            updateTime: 2345678313,
            mysqlStatus: 0,
            brokerStatus: 0,
            
        },
        
    ],
    "success": true
}
	var mysqlDetail = {
    "data": {
        "cfClusterName": "cf222",
        "cfMysql": "1.12",
        "componentDomain": "paas",
        "components": [
            {
                "count": 1,
                "cpuCore": 1,
                "memory": "1024",
                "name": "mysql",
                "netId": "paas_Vlan2669",
                "overload": false
            }
        ],
        "deployId": "todayisgood",
        "deploymentName": "helloq",
        "directorUuid": "fd80c9ac-4009-4b17-b7d5-4c6b0e5d2fa7",
        "networkId": "paas_Vlan2669",
        "rootDomain": "jiawei.zhou",
        "runingtimeDomain": 'ssss',
        "serviceBroker": {
            "appId": null,
            "appName": null,
            "disk": "50",
            "ip": "10.109.3.48",
            "memory": "512",
            "serviceBrokerGuid": "228756a7-9af4-43e4-a1fd-7d80aaf096df",
            "status": null,
            "userId": null,
            "userName": null
        }
    },
    "success": true
};


 var mysqlcomp = {
    "data": [
        {
            "amount": 1,
            "cpuUsage": 0.7,
            "memoryUsage": 21,
            "name": "mysql1",
            "status": 1
        },
        {
            "amount": 1,
            "cpuUsage": 0.1,
            "memoryUsage": 2,
            "name": "proxy",
            "status": 1
        },
        {
            "amount": 1,
            "cpuUsage": 0.1,
            "memoryUsage": 6,
            "name": "cf_mysql_broker",
            "status": 1
        },
        {
            "amount": 1,
            "cpuUsage": 0.1,
            "memoryUsage": 20,
            "name": "mysql2",
            "status": 1
        }
    ],
    "success": true
};

var compDetail = {
    "data": [
        {
            "cpuCore": 0,
            "cpuLoad": "0.03,0.02,0.05",
            "cpuUsage": 0.6,
            "index": 0,
            "ip": "10.37.1.244",
            "memoryUsage": 22,
            "status": 1
        }
    ],
    "success": true
};

var adminName = {
    "data": 
        {
            "username": "替你的烦恼"
        },
    "success": true
};
	var directorUuid = {success:true,data:{directorUuid:'sdfdfdfdfd'}};

	var log = {data: {offset: 9195, log: [{flag: 1, message: "task is error"},{flag: 2, message: 'Creating bound missing VMs > loggregator_trafficcontroller/0 failed\n{error=Expected(204) <=> Actual(403 Forbidden)\nexcon.error.response\n :body => \"\"\n :headers => {\n \"Content-Length\" => \"0\"\n \"Content-Type\" => \"text/plain\"\n \"Date\" => \"Sun, 13 Mar 2016 07:14:00 GMT\"\n \"Server\" => \"SNMW1.0\"\n \"Set-Cookie\" => \"JSESSIONID=aw7vDgq2S705sAeSJza_1_ZE.master:fserver1; path=\"\n \"Vary\" => \"Accept-Encoding\"\n }\n :local_address => \"10.37.1.199\"\n :local_port => 52181\n :reason_phrase => \"Forbidden\"\n :remote_ip => \"10.27.208.132\"\n :status => 403\n :status_line => \"HTTP/1.1 403 Forbidden\\r\\n\"\n}'},{flag: 3, message: "task is error"}]},success:true};
	var crres = {success:true,data:{taskId:'sdfdfdfdfd'}};

	var loglist = {"data":[{"create_time":"1458205884000","taskId":"919"},{"create_time":"1458031516000","taskId":"999"}],"success":true};

$httpBackend.whenGET(/^\/rest\/cluster\/listTasksInfo/).respond(loglist);
	$httpBackend.whenGET(/^\/rest\/user\/list/).respond(users);
	$httpBackend.whenGET(/^\/rest\/user\/detail/).respond(userDetail);
	$httpBackend.whenGET(/^\/rest\/version\/list/).respond(version);
	$httpBackend.whenGET(/^\/rest\/cluster\/monitor/).respond(comp);
	$httpBackend.whenGET(/^\/rest\/cluster\/component/).respond(clusterMonit);
	$httpBackend.whenGET(/^\/rest\/cluster\/list/).respond(clusterList);

	$httpBackend.whenGET(/^\/rest\/login\/getCurrentUser/).respond(adminName);

	$httpBackend.whenGET(/^\/rest\/login\/logout/).respond(adminName);
	

	$httpBackend.whenPOST(/^\/rest\/cluster\/save/).respond(clusterList);
	$httpBackend.whenPOST(/^\/rest\/mysqlCluster\/save/).respond(clusterList);

	$httpBackend.whenPOST(/^\/rest\/cluster\/create/).respond(clusterList);
	$httpBackend.whenPOST(/^\/rest\/mysqlCluster\/create/).respond(crres);

	$httpBackend.whenGET(/^\/rest\/cluster\/detail/).respond(clusterDetail);
	$httpBackend.whenGET(/^\/rest\/workOrder\/list/).respond(wnList);
	$httpBackend.whenGET(/^\/rest\/workOrder\/detail/).respond(wodetail);
	$httpBackend.whenPOST(/^\/rest\/workOrder\/reply/).respond(clusterList);

	$httpBackend.whenGET(/^\/rest\/mysqlCluster\/component/).respond(mysqlcomp);


	$httpBackend.whenGET(/^\/rest\/mysqlCluster\/list/).respond(mysqllist);

	$httpBackend.whenGET(/^\/rest\/mysqlCluster\/detail/).respond(mysqlDetail);

	$httpBackend.whenGET(/^\/rest\/mysqlCluster\/monitor/).respond(compDetail);
	$httpBackend.whenGET(/^\/rest\/cluster\/getDirectorUuid/).respond(directorUuid);
	$httpBackend.whenGET(/^\/rest\/cluster\/deployingLog/).respond(log);
	




  $httpBackend.whenGET(/^\/rest\//).passThrough();
  $httpBackend.whenGET(/^\/template\//).passThrough();
  $httpBackend.whenGET(/^\/cloudManage\//).passThrough();
}]);